using AppToolKit.Core.Logging;
using System;
namespace AppToolKit.Core
{
	public abstract class AppObjectBase : IAppObject
	{
		protected LoggerHelper logHelper_;
		public virtual LoggerHelper LogHelper
		{
			get
			{
				return this.logHelper_;
			}
			set
			{
				this.logHelper_ = value;
			}
		}
		public virtual void LogError(Exception ex)
		{
			string callingMethod = LoggerHelper.GetCallingMethod();
			this.logHelper_.GetErrorLogger().Error(string.Format("[{0}]{1}", callingMethod, ex.Message));
			this.logHelper_.GetErrorLogger().Error(ex.StackTrace);
			this.logHelper_.GetMainLogger().Info(string.Format("[{0}]{1}", callingMethod, ex.Message));
		}
		public virtual void DebugFormat(string msg, params object[] args)
		{
			string callingMethod = LoggerHelper.GetCallingMethod();
			string arg = string.Format(msg, args);
			this.logHelper_.GetDebugLogger().Debug(string.Format("[{0}]{1}", callingMethod, arg));
			this.logHelper_.GetMainLogger().Info(string.Format("[{0}]{1}", callingMethod, arg));
		}
		public virtual void InfoFormat(string msg, params object[] args)
		{
			string callingMethod = LoggerHelper.GetCallingMethod();
			string arg = string.Format(msg, args);
			this.logHelper_.GetMainLogger().Info(string.Format("[{0}]{1}", callingMethod, arg));
		}
	}
}
